﻿using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ProductShop
{
    class Controller
    {
        private readonly IPresenterLogin login;
        private readonly IPresenterMain main;

        public Controller(IPresenterLogin login, IPresenterMain main)
        {
            this.login = login;
            this.main = main;

            login.LoginAccepted += RunMainPresenter;
            login.RegistrationAccepted += RunMainPresenter;
        }

        public void RunLoginPresenter()
        {
            login.ShowLoginView();
        }

        public void RunMainPresenter()
        {
            PresenterMain presenter = new PresenterMain(new FormProductShop(), new UnitOfWork(new ShopDBContext()));
            presenter.ShowMainView();
            login.CloseLoginView();
        }
    }
}
